import request from '@/utils/request'

//获取-员工列表
export function getEmployeeRequest (params) {
  return request.get('/sys/user',{
    params
  })
}
//删除-员工
export function delEmployeeRequest (id) {
  return request.delete(`/sys/user/${id}`)
}

//批量-导出员工excel   responseType: 'blob' // 使用blob接收二进制文件流
export function userExportRequest () {
  return request({
    url:`/sys/user/export`,
    method:'get',
    responseType: 'blob'
  })
}

//批量-下载导入员工模板
export function templateExportRequest () {
  return request({
    url:`/sys/user/import/template`,
    method:'get',
    responseType: 'blob'
  })
}

//批量-导入员工(上传excel)
export function uploadExcel(data) {
  return request({
    url: '/sys/user/import',
    method: 'post',
    data // form-data类型 因为要上传文件类型
  })
}

//新增-员工
export function addEmployeeRequest (data) {
  return request.post(`/sys/user/`,data)
}

//获取-员工-基本信息
export function getEmployeeInfoByIdRequest (id) {
  return request.get(`/sys/user/${id}`)
}
//修改-员工-基本信息
export function updateEmployeeInfoByIdRequest (data) {
  return request.put(`/sys/user/${data.id}`,data)
}

//获取-已启用的角色列表
export function getEnabledRoleListRequest () {
  return request.get(`/sys/role/list/enabled`)
}

//分配-员工-角色
export function assignRolesRequest (data) {
  return request.put(`/sys/user/assignRoles`,data)
}